package com.kh.pajx.sop.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kh.pajx.sop.base.BaseServiceImpl;
import com.kh.pajx.sop.dao.IHsNoticeDao;
import com.kh.pajx.sop.domain.HsNotice;
import com.kh.pajx.sop.service.IHsNoticeService;
import com.kh.pajx.sop.util.page.QueryHelper;
import com.kh.pajx.sop.util.sop.PropertyValidate;

/**
 * 公告管理业务实现类
 * @author mxl
 * @return
 * @createDate 2015年2月27日 下午5:30:35
 */
@Service
@Transactional
public class HsNoticeServiceImpl extends BaseServiceImpl<HsNotice> implements IHsNoticeService{
	
	@Resource
	private IHsNoticeDao hsNoticeDao;
	
	@Override
	public List<HsNotice> getAll() {
		
		return hsNoticeDao.getAll();
	}
	
	@Override
	public void save(HsNotice demo) {
		
		hsNoticeDao.save(demo);
	}
	
	@Override
	public void update(HsNotice demo) {
		
		hsNoticeDao.update(demo);
	}
	
	@Override
	public HsNotice getById(String uuid) {
		
		return hsNoticeDao.getById(uuid);
	}

	@Override
	public void findNoticeList(HsNotice model, int pageNum, int numPerPage) {
		
		QueryHelper helper = new QueryHelper(HsNotice.class,"nt");
		//标题
		helper.addCondition(StringUtils.isNotEmpty(model.getTitle()), "title like ?","%"+StringUtils.trim(model.getTitle())+"%");
		
		//helper.addOrderProperty("createTime", false);
		helper.preparePageBean(hsNoticeDao, pageNum, numPerPage);
	}

}
